const axios = require("axios");
const { getRepoListURL, getTagsListURL } = require("./config");

axios.interceptors.response.use((res) => {
  return res.data;
});

/**
 * @name 获取模版列表
 */
const getRepoList = async () => {
  return await axios.get(getRepoListURL);
};

/**
 * @name 获取版本信息
 */
const getTagList = async (repo) => {
  let _getTagsListURL = getTagsListURL.replace("$1", repo);
  return await axios.get(_getTagsListURL);
};

module.exports = {
  getRepoList,
  getTagList,
};
